import java.util.*;

class Orange{
    long a;
    long b;
    Orange(){

    }
    Orange(long a,long b){
        this.a=a;
        this.b=b;
    }
}
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n=in.nextInt();
        int k=in.nextInt();
        Orange[] oranges=new Orange[n];
        for(int i=0;i<n;i++){
            oranges[i]=new Orange();
            oranges[i].a=in.nextLong();
        }
        for(int i=0;i<n;i++){
            oranges[i].b=in.nextLong();
        }
        Arrays.sort(oranges,(x,y)->{
            if(x.b==y.b){
                return (int)(x.a-y.a);
            }
            return (int)(y.b-x.b);
        });
        long aa=0,bb=0;
        for(int i=0;i<k;i++){
            aa+=oranges[i].a;
            bb+=oranges[i].b;
        }
        System.out.println(aa+" "+bb);
    }
}